package cn.com.test.common.listener;

import javax.servlet.ServletContextAttributeEvent;
import javax.servlet.ServletContextAttributeListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class MyContentListener implements ServletContextListener, ServletContextAttributeListener {
	@Override
	public void contextInitialized(ServletContextEvent servletContextEvent) {
		System.out.println("contextInitialized->servlet上下文名称 " + servletContextEvent.getServletContext().getServletContextName());
		System.out.println("contextInitialized->getInitParameterNames " + servletContextEvent.getServletContext().getInitParameterNames());

	}

	@Override
	public void contextDestroyed(ServletContextEvent servletContextEvent) {
		System.out.println("contextDestroyed->servlet上下文名称" + servletContextEvent.getServletContext().getServletContextName());
		System.out.println("contextDestroyed->getInitParameterNames" + servletContextEvent.getServletContext().getInitParameterNames());
	}

	@Override
	public void attributeAdded(ServletContextAttributeEvent servletContextAttributeEvent) {
		System.out.println("servlet上下文属性增加，属性名：" + servletContextAttributeEvent.getName() + "属性值： " + servletContextAttributeEvent.getValue());
	}

	@Override
	public void attributeRemoved(ServletContextAttributeEvent servletContextAttributeEvent) {
		System.out.println("servlet上下文属性移除，属性名： " + servletContextAttributeEvent.getName() + "属性值：  " + servletContextAttributeEvent.getValue());
	}

	@Override
	public void attributeReplaced(ServletContextAttributeEvent servletContextAttributeEvent) {
		System.out.println("servlet上下文属性替换，属性名： " + servletContextAttributeEvent.getName() + "属性值：  " + servletContextAttributeEvent.getValue());
	}
}
